package com.example.zwx.myapplication.control;

/**
 * Created by Administrator on 2016/2/26.
 */
public class BleSendTask {
    /**
     * 当前红外数据是否写成功
     */
    private boolean writeOk = false;

    /**
     * 当前红外数据是否接收到正确反馈
     */
    private boolean readOk = false;


    /**
     * 全部数据是否发送成功
     */
    private boolean isSendOk = false;

    /**
     * 下一个要发送的红外码顺序index
     */
    private int position = 0;


    /**
     * 红外数据
     */
    private byte[][] rawIR;


    public void reset(byte[][] irBytes) {
        this.rawIR = irBytes;
        setPosition(0);
        setReadOk(false);
        setWriteOk(false);
        setSendOk(false);
    }

    public boolean isWriteOk() {
        return writeOk;
    }

    public void setWriteOk(boolean writeOk) {
        this.writeOk = writeOk;
    }

    public boolean isReadOk() {
        return readOk;
    }

    public void setReadOk(boolean readOk) {
        this.readOk = readOk;
    }

    public int getPosition() {
        return position;
    }

    public void setPosition(int position) {
        this.position = position;
    }

    public boolean isSendOk() {
        return isSendOk;
    }

    public void setSendOk(boolean sendOk) {
        isSendOk = sendOk;
    }

    public byte[][] getRawIR() {
        return rawIR;
    }

    public void setRawIR(byte[][] rawIR) {
        this.rawIR = rawIR;
    }

    public byte[] getIR() {
        if (rawIR == null) {
            return null;
        }
        if (position >= 0 && position < rawIR.length) {
            return rawIR[position];
        }

        return null;
    }
}
